<template>

  <section>
    <el-form label-width="100px" :inline="true" :model="form">
      <el-form-item label="姓名/就诊号">
        <el-input  placeholder="姓名/就诊号" v-model="form.keyword" @keydown.native.prevent.enter="searchUser"></el-input>
      </el-form-item>
      <el-form-item label="就诊日期">
        <el-date-picker v-model="value7" type="daterange" align="right" unlink-panels range-separator= "/" start-placeholder="开始日期" end-placeholder="结束日期"
          :picker-options="pickerOptions2">
        </el-date-picker>
      </el-form-item>
      <el-button icon="el-icon-search" circle  @click="searchUser"></el-button>
    </el-form>

  </section>

</template>

<script>
  import errHandler from '@/assets/errHandler'
  import {mapGetters, mapActions, mapMutations} from 'vuex'
  import ElInput from "../../../node_modules/element-ui/packages/input/src/input.vue";

  export default {
    components: {ElInput},
    name:"registered",

    data(){
      return {
        form: {
          keyword: undefined,
        },
        groups:[],
        users:[]
      }
    },
    methods:{
      searchUser:function(){
        console.log(this.form)
        const req = {
          keyword: this.form.keyword
        };
        console.log(req)
        this.$store.dispatch({
          type:'fetch',
          name:'getCustomerList',
          data:{...req},
          method:'post'
        }).then(res=>{
          if(res.errCode){
            this.$message({
              message:res.errMsg,
              type: 'error'
            });
          }else{
            console.log(res);
            this.users = res;
          }
        }).catch(error=>{
          this.$message({
            message:error,
            type: 'error'
          });
        });
      },
    }

  }
</script>
